import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_chubao/tools/app_textstyle.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';

class AppWidgetAppbar extends AppBar {
  final String titleStr;
  final String? backImg;
  // @override
  // final SystemUiOverlayStyle? systemOverlayStyle;
  final Color? backColor;
  final Color? arrowColor;
  final bool isBack;

  final Widget? titleWidget;

  AppWidgetAppbar(
      {this.titleStr = '',
      // this.systemOverlayStyle,
      this.backColor,
      this.backImg,
      this.titleWidget,
      this.isBack = true,
      this.arrowColor});
  @override
  SSWidgetAppbarState createState() => SSWidgetAppbarState();
}

class SSWidgetAppbarState extends State<AppWidgetAppbar> {
  @override
  Widget build(BuildContext context) {
    return AppBar(
      centerTitle: true,
      systemOverlayStyle: widget.systemOverlayStyle,
      backgroundColor: widget.backColor ?? Colors.white,
      elevation: 0,
      leading: widget.isBack
          ? GestureDetector(
              behavior: HitTestBehavior.opaque,
              child: Container(
                  margin: EdgeInsets.only(left: 12.w),
                  width: 44,
                  height: 44,
                  alignment: Alignment.center,
                  child: const Icon(
                    Icons.arrow_back_ios,
                    color: Colors.black,
                  )),
              onTap: () {
                // Navigator.pop(context);
                Get.back();
              },
            )
          : null,
      title: widget.titleWidget ??
          Text(widget.titleStr,
              style: AppTextStyle.getBoldTextStyle(fontSize: 16)),
    );
  }

  @override
  void initState() {
    super.initState();
  }

  @override
  void dispose() {
    super.dispose();
  }

  @override
  void didUpdateWidget(AppWidgetAppbar oldWidget) {
    super.didUpdateWidget(oldWidget);
  }

  @override
  void didChangeDependencies() {
    super.didChangeDependencies();
  }
}
